<!DOCTYPE html>
<html class="" lang="en">
	<head>
		{% include 'twig/common/header/include.twig' %}
		<script src="/dev/lib/handlebars-v4.0.10.js" type="text/javascript" charset="utf-8"></script>
		<script src="/dev/lib/bootstrap-paginator/src/bootstrap-paginator.js?v=<?=_version?>" type="text/javascript"></script>
		<script src="/dev/js/admin/project.js?v=<?=_version?>" type="text/javascript" charset="utf-8"></script>
	</head>
	<body class="" data-group="" data-page="projects:issues:index" data-project="xphp">
		{% include 'twig/common/body/script.twig' %}

		<section class="has-sidebar page-layout max-sidebar">
			{% include 'twig/common/body/page-left.twig' %}

			<div class="page-layout page-content-body system-page">
				{% include 'twig/common/body/header-content.twig' %}

				<script>
					var findFileURL = "";
				</script>
				<div class="page-with-sidebar">

					{% include 'twig/admin/common-page-nav-admin.twig' %}

					<div class="content-wrapper page-with-layout-nav page-with-sub-nav">
						<div class="alert-wrapper">

							<div class="flash-container flash-container-page"></div>

						</div>
						<div class="container-fluid">
							<div class="content" id="content-body">
								{% include 'twig/admin/common_project_left_nav.twig' %}
								<div class="row has-side-margin-left">
									<div class="col-lg-12">
										<div class="top-area">
											<ul class="nav-links user-state-filters" style="float:left">
												<li class="active" data-value="">
													<a id="state-opened" title="项目列表">
													<span>
														项目列表
													</span>
													</a>
												</li>
											</ul>
											<div class="nav-controls" style="">
												<!--a class="btn has-tooltip" title="" href="#" data-original-title="邀请用户">
                                                                            <i class="fa fa-rss"></i>
                                                                        </a-->
												<div class="project-item-select-holder">
													<a class="btn btn-new new-project-item-select-button js-key-create" data-key-mode="new-page" href="/project/main/new">
														<i class="fa fa-plus"></i>
														新建项目
													</a>
												</div>
											</div>
										</div>

										<div class="content-list pipelines">
											<div class="table-holder">
												<table class="table">
													<thead>
													<tr>
														<th class="js-pipeline-info pipeline-info">名称</th>
														<th class="js-pipeline-info pipeline-info">KEY</th>
														<th class="js-pipeline-info pipeline-info">项目类型</th>
														<th class="js-pipeline-stages pipeline-info">项目负责人</th>
														<th class="pipeline-info">操作</th>
													</tr>
													</thead>
													<tbody id="render_id"></tbody>
												</table>
											</div>
											<div class="gl-pagination" id="ampagination-bootstrap"></div>
										</div>
									</div>


								</div>
							</div>
						</div>

					</div>
				</div>

			</div>
		</section>

		{% verbatim %}
			<script type="text/html" id="project_tpl">
				{{#rows}}
					<tr class="commit">
						<td>
							<a href="/{{path}}/{{key}}" class="commit-id monospace" target="_blank">
								{{name}}
							</a>
						</td>
						<td>
							<a href="/{{path}}/{{key}}" class="commit-id monospace" target="_blank">
								{{key}}
							</a>
						</td>
						<td>
							<a href="javascript:void(0);" class="commit-id monospace">
								{{type_name}}
							</a>
						</td>
						<td>
							<a href="javascript:void(0)" class="commit-id monospace">
								{{leader_display}}
							</a>
						</td>
						<td>
							<a class="js_admin_do_archived btn btn-transparent " style="padding: 6px 2px;" data-id="{{id}}" data-name="{{name}}" >归档</a>
							<a class="btn btn-transparent " href="/{{path}}/{{key}}/settings" data-project_id="{{id}}" style="padding: 6px 2px;" target="_blank">编辑</a>
							<a class="js_clone_config btn btn-transparent" href="javascript:;" data-project_id="{{id}}" style="padding: 6px 2px;">克隆</a>
							<a class="js_admin_do_delete btn btn-transparent" style="padding: 6px 2px;" data-project_id="{{id}}" data-type="{{type}}" data-name="{{name}}" >
								<i class="fa fa-trash"></i><span class="sr-only">Remove</span>
							</a>
						</td>
					</tr>
				{{/rows}}

			</script>
		{% endverbatim %}




		<div class="modal" id="modal-project_clone">
			<form class="js-quick-submit js-upload-blob-form form-horizontal"
				  action="/admin/project"
				  accept-charset="UTF-8"
				  method="post"
				  id="form-project_clone">
				<input type="hidden" name="project_id" id="modal_form_project_id" value="">
				<div class="modal-dialog">
					<div class="modal-content modal-middle">
						<div class="modal-header">
							<a class="close js-key-modal-close2" data-dismiss="modal" href="#">×</a>
							<h3 class="modal-header-title">克隆项目</h3>
						</div>

						<div class="modal-body">
							<div class="form-group">
								<label class="control-label" for="project_name">新项目名称:<span class="required"> *</span></label>
								<div class="col-sm-6">
									<div class="form-group">
										<input type="text" class="form-control" name="project_name" id="project_name" value=""/>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="control-label" for="project_key">新项目KEY:<span class="required"> *</span></label>
								<div class="col-sm-6">
									<div class="form-group">
										<input type="text" class="form-control" name="project_key" id="project_key" value=""/>
									</div>
								</div>
							</div>

							<hr>

							<div class="form-group">
								<label class="control-label" for="label_selected">成员&角色:</label>
								<div class="col-sm-5">
									<div class="form-group">
										<div class="checkbox">
											<label for="project_printing_merge_request_link_enabled">
												<input type="checkbox" disabled checked>
												<strong>克隆项目成员和角色</strong>
											</label>
										</div>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="control-label" for="sprint_selected">迭代:</label>
								<div class="col-sm-5">
									<div class="form-group">
										<div class="checkbox">
											<label for="project_printing_merge_request_link_enabled">
												<input type="checkbox" value="1" name="sprint_selected" id="sprint_selected" >
												<strong>克隆项目迭代</strong>
											</label>
										</div>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="control-label" for="version_selected">版本:</label>
								<div class="col-sm-5">
									<div class="form-group">
										<div class="checkbox">
											<label for="project_printing_merge_request_link_enabled">
												<input type="checkbox" value="1" name="version_selected" id="version_selected" >
												<strong>克隆项目版本</strong>
											</label>
										</div>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="control-label" for="module_selected">模块:</label>
								<div class="col-sm-5">
									<div class="form-group">
										<div class="checkbox">
											<label for="project_printing_merge_request_link_enabled">
												<input type="checkbox" value="1" name="module_selected" id="module_selected" >
												<strong>克隆项目模块</strong>
											</label>
										</div>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="control-label" for="catalog_label_selected">分类:</label>
								<div class="col-sm-5">
									<div class="form-group">
										<div class="checkbox">
											<label for="project_printing_merge_request_link_enabled">
												<input type="checkbox" value="1" name="catalog_label_selected" id="catalog_label_selected" >
												<strong>克隆项目分类</strong>
											</label>
										</div>
									</div>
								</div>
							</div>

							<div class="form-group">
								<label class="control-label" for="label_selected">标签:</label>
								<div class="col-sm-5">
									<div class="form-group">
										<div class="checkbox">
											<label for="project_printing_merge_request_link_enabled">
												<input type="checkbox" value="1" name="label_selected" id="label_selected" >
												<strong>克隆项目标签</strong>
											</label>
										</div>
									</div>
								</div>
							</div>



						</div>

						<div class="modal-footer">
							<button name="submit" type="button" class="btn btn-save js-key-modal-enter2" id="btn-do_project_clone">确定</button>
							<a class="btn btn-cancel" data-dismiss="modal" href="#">取消</a>
						</div>

					</div>
				</div>
			</form>
		</div>


		<script>
			var project = null;
			var options = {

			};
			$(function () {
				project = new Project(options);
				project.fetchList('/admin/project/filterData', 'project_tpl', 'render_id', 1, 0);

				$("#modal-project_clone").on('show.bs.modal', function () {
					keyMaster.addKeys([
						{
							key: ['command+enter', 'ctrl+enter'],
							'trigger-element': '.js-key-modal-enter2',
							trigger: 'click'
						},
						{
							key: 'esc',
							'trigger-element': '.js-key-modal-close2',
							trigger: 'click'
						}
					])

				});

				$("#btn-do_project_clone").click(function(){
					project.doClone($('#modal_form_project_id').val());
				});

            });
		</script>

		<div class="modal fade" tabindex="-1" role="dialog" id="myModal">
			<div class="modal-dialog modal-sm" role="document">
				<div class="modal-content modal-middle">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-label="Close">
							<span aria-hidden="true">&times;</span>
						</button>
						<h4 class="modal-title">提示</h4>
					</div>
					<div class="modal-body">
						<p>是否确认删除？</p>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-primary">确定</button>
						<button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
					</div>
				</div>
			</div>
		</div>
	</body>
</html>
